import React from 'react';
import { Space, Table, Tag } from 'antd';

const GenericTable = ({ columns, dataSource, onInvite, onDelete }) => {
    // 处理操作列的渲染，绑定事件处理函数
    const processedColumns = columns.map((column) => {
        if (column.key === 'action') {
            return {
                ...column,
                render: (_, record) => (
                    <Space size="middle">
                        <a onClick={() => onInvite(record)}>Invite {record.name}</a>
                        <a onClick={() => onDelete(record)}>Delete</a>
                    </Space>
                )
            };
        }
        return column;
    });

    return (
        <Table
            columns={processedColumns}
            dataSource={dataSource}
            className="custom-table"
            pagination={false} 
        />
    );
};

export default GenericTable;